﻿using System.Collections.Generic;
using System.Linq;

namespace DataFillerTest
{
    public class TestModel
    {
        public string V1 { get; set; }
        public string V2 { get; set; }
        public List<Address> Addresses { get; set; }
        public List<Person> Persons { get; set; }
        public List<ContactType> ContactTypes { get; set; }
        public Table043 Model043 { get; set; }
        public string Empty
        {
            get
            {
                return " ";
            }
        }
    }

    public class Address
    {
        public string AddressID { get; set; }
        public string City { get; set; }
        public string PostalCode { get; set; }
        public string SpatialLocation { get; set; }
        public string ModifiedDate { get; set; }
    }

    public class Person
    {
        public string PersonType { get; set; }
        public string NameStyle { get; set; }
        public string Title { get; set; }
        public string FirstName { get; set; }
    }

    public class ContactType
    {
        public string ContactTypeID { get; set; }
        public string Name { get; set; }
        public string ModifiedDate { get; set; }
    }

    public class Table043
    {
        public string FormationUnit { get; set; }
        public string FormationDate { get; set; }
        public string Unit { get; set; }
        public int Total
        {
            get
            {
                return AssetInformations.Sum(p => p.Count);
            }
        }
        public int TotalPrice
        {
            get
            {
                return AssetInformations.Sum(p => p.Price);
            }
        }

        public List<Asset> AssetInformations { get; set; }
        public IEnumerable<Asset> WithoutSubtotal
        {
            get
            {
                return AssetInformations.Where(p => p.Type == AssetType.WithoutSubtotal);
            }
        }
        public IEnumerable<Asset> InstrumentSubtotal
        {
            get
            {
                return AssetInformations.Where(p => p.Type == AssetType.InstrumentSubtotal);
            }
        }
        public IEnumerable<Asset> FurnitureSubtotal
        {
            get
            {
                return AssetInformations.Where(p => p.Type == AssetType.FurnitureSubtotal);
            }
        }
        public IEnumerable<Asset> Others
        {
            get
            {
                return AssetInformations.Where(p => p.Type == AssetType.Others);
            }
        }
    }
    public class Asset
    {
        public int Code { get; set; }
        public string StdName { get; set; }
        public string ModelNumber { get; set; }
        public string Partner { get; set; }
        public string Location { get; set; }
        public string MeasurementUnit { get; set; }
        public int Count { get; set; }
        public int Price { get; set; }
        public AssetType Type { get; set; }
        public AssetAllocation Allocation { get; set; }
        public string Empty
        {
            get
            {
                return " ";
            }
        }
    }
    public class AssetAllocation
    {
        public int FixedAssets { get; set; }
        public int CurrentAssets { get; set; }
    }
    public enum AssetType : int
    {
        WithoutSubtotal = 0,
        InstrumentSubtotal,
        FurnitureSubtotal,
        Others
    }

    public class TestRow
    {
        public List<TestCell> Cells { get; set; }
        public int RowNumber { get; set; }
    }

    public class TestCell
    {
        public int CellNumber { get; set; }
        public dynamic Data { get; set; }
        public dynamic Style { get; set; }

        public InnerType TestProperty { get; set; }
    }

    public class InnerType
    {
        public int Property1 { get; set; }
        public InnerType Property2 { get; set; }
        public List<InnerType> Property3 { get; set; }
    }

}
